package com.xy.demo.thread;

import com.xy.demo.Util.Util;
import com.xy.demo.model.Bill;
import com.xy.demo.service.BillService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;

/**
 * @BelongsProject: bill
 * @BelongsPackage: com.xy.demo.thread
 * @Author: YangHao
 * @CreateTime: 2023-08-09  15:52
 * @Description: 处理线程类
 * @Version: 1.0
 */
public class ThreadForAutoExecuteRun {

    protected Object object;

    @Autowired
    private BillService billService;


    public ThreadForAutoExecuteRun() {
    }

    public ThreadForAutoExecuteRun( Object object,BillService billService) {
        this.object = object;
        this.billService = billService;
    }

    public void insetAutoExecuteForStockStatusChange(){
        Map map = (Map) object;
        Long changeId = (Long) map.get("changeId");
        Bill bill = new Bill();
        bill.setBillNo(Util.toString(changeId));
        billService.insertOne(bill);
    }
}
